<html>
<head><meta charset="utf-8"><title>-Ztreat-err-as-bug off by one issue · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html">-Ztreat-err-as-bug off by one issue</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="195232374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195232374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195232374">(Apr 24 2020 at 19:14)</a>:</h4>
<p>Meanwhile I was working on <a href="https://github.com/rust-lang/rust/issues/71488" title="https://github.com/rust-lang/rust/issues/71488">#71488</a>, I've found a problem with <code>-Ztreat-err-as-bug</code></p>



<a name="195232433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195232433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195232433">(Apr 24 2020 at 19:15)</a>:</h4>
<p>we were looking briefly with <span class="user-mention" data-user-id="119009">@eddyb</span> and found an off by one issue in <code>delay_span_bug</code></p>



<a name="195232471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195232471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195232471">(Apr 24 2020 at 19:15)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/rust/issues/71489" title="https://github.com/rust-lang/rust/issues/71489">#71489</a></p>



<a name="195232571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195232571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195232571">(Apr 24 2020 at 19:16)</a>:</h4>
<p>I'm not proud of the code, maybe this needs a little better refactor because there are places where the count is incremented afterwards and other places when it's incremented beforehand</p>



<a name="195232719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195232719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195232719">(Apr 24 2020 at 19:17)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@LeSeulArtichaut</span> maybe this problem is related to what you were saying <a href="#narrow/stream/227806-t-compiler.2Fwg-prioritization/topic/I-prioritize.20.2371359.20Regression.20in.20usable.20type.20complexity.3A.20ov/near/194823789" title="#narrow/stream/227806-t-compiler.2Fwg-prioritization/topic/I-prioritize.20.2371359.20Regression.20in.20usable.20type.20complexity.3A.20ov/near/194823789">here</a>?</p>



<a name="195232859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195232859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195232859">(Apr 24 2020 at 19:18)</a>:</h4>
<p>also <code>-Ztreat-err-as-bug</code> is undertested so I'm pretty sure that there are more bugs :)</p>



<a name="195453603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195453603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195453603">(Apr 27 2020 at 17:58)</a>:</h4>
<p>I'm not surprised, <code>treat-err-as-bug</code> had originally only a "panic when encountering error" strategy, and teaching it to accept a number was a hack that I hastily added in order to debug something else entirely :)</p>



<a name="195458877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195458877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195458877">(Apr 27 2020 at 18:43)</a>:</h4>
<p><span class="user-mention" data-user-id="119031">@Esteban Küber</span> I have the feeling that we have this kind of issues in more places, I guess would be nice to add tests and then try to fix it and maybe even refactor the code a bit :)</p>



<a name="195458918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195458918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195458918">(Apr 27 2020 at 18:43)</a>:</h4>
<p>any pointers on ideas you have or something are welcome, I have no idea about the code base but I may have time to take a look at it</p>



<a name="195458972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195458972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195458972">(Apr 27 2020 at 18:44)</a>:</h4>
<p>The reason it's not as thoroughly tested is because we're the only ones using it</p>



<a name="195459005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459005">(Apr 27 2020 at 18:44)</a>:</h4>
<p>And delay_span_bug is also kind of a hack</p>



<a name="195459012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459012">(Apr 27 2020 at 18:44)</a>:</h4>
<p>who is we? :P</p>



<a name="195459021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459021">(Apr 27 2020 at 18:44)</a>:</h4>
<p>We could keep two different counts</p>



<a name="195459035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459035">(Apr 27 2020 at 18:44)</a>:</h4>
<p>People hacking on rustc</p>



<a name="195459043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459043">(Apr 27 2020 at 18:44)</a>:</h4>
<p>ahh right</p>



<a name="195459114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459114">(Apr 27 2020 at 18:45)</a>:</h4>
<p>right now seems to be that increasing the err count is some times done after emitting and in other places it's done before</p>



<a name="195459214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459214">(Apr 27 2020 at 18:46)</a>:</h4>
<p>I guess we may refactor the code to be more sure that we always emit and increment or vice-versa but always in the same order</p>



<a name="195459699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459699">(Apr 27 2020 at 18:49)</a>:</h4>
<p>Probably low prio but useful to do</p>



<a name="195459896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Ztreat-err-as-bug%20off%20by%20one%20issue/near/195459896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Ztreat-err-as-bug.20off.20by.20one.20issue.html#195459896">(Apr 27 2020 at 18:51)</a>:</h4>
<p>yep :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>